import client from '../utils/client.js';

const LIMIT = 3;

// 偏移量：每次请求多少条
const OFFSET = (page)=>{
    return (page-1) *LIMIT
}



// 批量获取文章
const authorarticleAPI = {
    getAuthorArticles: (authorname, page) => client.get(`/articles?author=${authorname}&limit=${LIMIT}&offset=${OFFSET(page)}`),
    getFavoriteArticles: (authorname,page)=> client.get(`/articles?favorite=${authorname}&limit=${LIMIT}&offset=${OFFSET(page)}`),
}

export default authorarticleAPI;